Repository navigation
fix: pre-release hardening - #3
Draft
dorukozgen wants to merge 26 commits into
Draft
dorukozgen wants to merge 26 commits into
dorukozgen wants to merge 26 commits into
Conversation
The install route takes source_id + scope, the PR chip spells out its state, and onboarding's Continue is always enabled; the tests still expected the old behaviour. phase4_apis now also runs against a temporary FLEETIFY_HOME. Two tests raced: the python_runtime env tests now hold the crate's env lock, and the loopback child test no longer serves on the port its parent released for the unreachable proxy. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
The embedded backend now checks the Host header on every request, the UI files, /healthz and unmatched paths included. It answers only 127.0.0.1:<bound port> and localhost:<bound port>; any other host, or none, gets a plain-text 403. The check is the router's outermost layer. The CORS layer is gone. The app's pages share the backend's origin, or reach it through the Vite proxy in dev, which now sets the backend's Host on WebSocket upgrades as it already did for HTTP requests. serve() now takes ServeOptions (UI files, routing setup and a per-run API token) and replaces serve_with_routing_setup(). Nothing checks the token yet. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
The shell generates the backend's API token at startup, keeps it in Tauri state and starts the backend with it, so the backend and the renderer share one token per run. The renderer reads it with window.fleetify.getApiToken(), backed by the new backend_api_token command. Like every app command, it is allowed only for the main webview, through the app-commands set. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
TestServer::client() builds the reqwest client the integration tests send their requests with, from one place, with room for headers every request should carry. The access tests use it for every request that isn't sent over raw TCP. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
The access guard's tests and the telemetry client's tests each had a copy of the same tracing capture; they now share one in test_support. tower-http's cors feature has had no user since the CORS layer went away, so the workspace no longer enables it. The access tests also check that the guard's 403 is plain text, and that a cross-origin preflight reaches the router instead of being refused by the guard. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
The renderer asks the shell for this run's backend token once and sends it with every request to the backend. Fetches carry it in the X-Fleetify-Token header; WebSocket and EventSource URLs, which can't set a header, carry it as the api_token query parameter. apiFetch adds it next to the access token. The new backendFetch sends only the token, for the routes that don't check who is signed in, and the call sites that used a bare fetch now use one of the two. Renaming, pinning and reordering agents go through apiFetch, since their route checks the access token. The status stream and the Browser panel's URL socket open once the token is in hand, and not after their effect has been cleaned up. A source scan in the tests keeps bare backend fetches, and sockets or streams without the token, from coming back. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
The access guard now also asks API requests for this run's token. It reads it from the X-Fleetify-Token header. A WebSocket upgrade under /ws/ and GET /events/status may carry it in the api_token query parameter instead, since their URLs can't have a header. A missing, wrong or repeated token gets the same plain-text 403 as a wrong host. No token is needed for /healthz, for GET and HEAD of the UI files, for the /api/internal routes (their handlers check the internal secret) or for the system browser's MCP OAuth callback. Release builds always require the token. A debug build running with FLEETIFY_NOAUTH=1 doesn't, unless FLEETIFY_REQUIRE_API_TOKEN=1 is set; both are read once at startup. The integration tests that sign their own JWTs send the token through the shared test client, which now sets it by default. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
The file tree's create, delete and rename now send what the workspace
file API reads. Create sends { path, is_dir }, so "New folder" makes a
folder instead of an empty file. Delete sends its path as a JSON body.
Rename sends { from, to }, where to is the new name in the same folder,
joined with the separator the path already uses; a name that is empty,
"." or "..", or contains a separator is refused without a request.
All three take success from the reply's ok field, since the API also
answers 200 when an action fails.
Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
…y policy A release build now embeds the built UI in the executable, and the embedded backend serves exactly those files, each with a Content-Security-Policy, X-Content-Type-Options and Referrer-Policy. A path that is not one of the files gets an empty 404, and hashed assets may be cached for a year. The bundle no longer ships a dist folder, Tauri's own CSP setting is off, and `tauri build` stops when the UI has not been built. Browsers report what the policy blocks to POST /api/csp-report, which needs no API token; each report is logged on the fleetify.csp target. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
…ating the window The Preview pane pins only local dev servers (localhost or 127.0.0.1), the hosts the content security policy lets it frame, and says so when it refuses an address. The marketplace dialogs already cancel the browser's own form submission; tests now keep it that way. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
…click Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
…replies Create PR's trace is logged and shown when a step fails. Its lines now go without the user name and password a remote URL can hold, the origin URL it records included, and they are removed before a line is cut short. The failure diagnosis sends the AI provider `git remote -v` without them, and adding the origin remote answers with the existing URL without them. A remote URL that doesn't parse loses them as well. parse_origin reads the host after dropping them, so Create PR through the GitHub link accepts an origin URL that holds them. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
Open in editor now checks the path the way Reveal does before anything
looks at it: it must be absolute and exist, and a Windows network or
device path is refused. The editor is started with the resolved path.
A refused path gets the usual { ok: false, error } answer.
Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
…indows Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
The backend binds 127.0.0.1 with the default socket options again. On Windows the default bind on a specific address already refuses a second bind to the same address, and an exclusive bind can keep a quick relaunch from binding the port while a peer still holds its end of an old connection open. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
Both tests failed on every Windows CI run. Because the test step stops
at the first failing test binary, no backend integration test ran there.
run_command_times_out_cleanly asked cmd.exe to find `ping` on PATH, and
in the CI test process that lookup fails ("'ping' is not recognized").
Naming %SystemRoot%\System32\ping.exe skips the lookup. The test still
checks that a command running past its timeout comes back as a
"timed out" error.
build_ssh_args_expands_tilde_in_identity_file read the home directory
from USERPROFILE, which earlier tests leave pointing at a temp dir. On
the runner that dir is under C:\Users\RUNNER~1, so the expanded path
contained a `~` and `!path.contains('~')` failed although the expansion
was right. build_ssh_args now takes the home directory from its caller;
the test passes one that contains a `~` and checks the exact -i value.
Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
Without --no-fail-fast, cargo test stops after the first test binary that has a failure. On the Windows runner that meant a lib-test failure in fleetify-backend kept every backend integration test from running. The step stays advisory. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
run_command spawns every command through `cmd /C` with the PATH the app inherited. cmd.exe truncates a PATH longer than 8191 characters, and then not even System32 programs are found; the dev launch chain grows PATH well past that. The CLI-agent bridges already give their children the user's canonical PATH through apply_clean_path, and run_command now does the same. It is a no-op off Windows and keeps the inherited PATH when the registry can't be read. A Windows-only test runs a bare `where cmd` with the process PATH padded past the limit. The timeout test still names ping.exe by full path, so it stays about the timeout alone; its comment now says why. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
The comment gave a count of failing tests and a cause that no longer hold. It now says only what the step is: advisory, and run on the Windows runner. Signed-off-by: Doruk Özgen <140007919+dorukozgen@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-release hardening before v0.2.0. Draft: more commits are coming before review.
Done so far:
Still to come: